

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>


// Y:\denganz\denganzhi\New\rk3566_3568_sourcecode\external\char_drv  放入这里即可编译

int main(int argc,char **argv)
{
   int fp;
   int value;

//    fp = open("/dev/char_2th_drv",O_RDWR);
   fp = open("/dev/char_4th_drvctl",O_RDWR);

   if (fp < 0){
       printf("zhangxiaowei: /dev/char_4th_drvctl   drv open error \n");
   }

   value = atoi(argv[1]);

    printf("zhangxiaowei: char drv write value:%d \n", value);
    write(fp,&value,sizeof(value));

    usleep(10*1000);

    value =0;

    read(fp,&value,sizeof(value));

    printf("zhangxiaowei: char drv read value:%d \n", value);

    return 0;
}